<?php
function userInfo($params)
{

}

function getRolesList()
{
    $di = \Phalcon\Di::getDefault();
    $contentModelList = $di->getShared('entityManager')->contentModel('user');
    return $contentModelList;
}

function getRolesOptions()
{
    $rolesList = getRolesList();
    $options = array();
    foreach ($rolesList as $key => $role) {
        $options[$key] = $role['name'];
    }
    return $options;
}

function userList($query)
{
    $di = \Phalcon\Di::getDefault();
    $data = $di->getShared('entityManager')->find('user', $query);
    return $data;
}

function isExistUserLog($uid, $type)
{
    $userLog = \Modules\User\Models\UserLog::findFirst(array(
        'conditions' => 'uid = :uid: AND type = :type:',
        'bind' => array(
            'uid' => $uid,
            'type' => $type
        )
    ));
    if ($userLog) {
        return true;
    }
    return false;
}